#!/bin/bash

# traz as copias dos confs
# Matheus - 12/12/2014
# Matheus - 08/01/2015 - copiar arquivos de conf de rede

. consulta_versao_scripts.conf

# comecando do 1, para pular o rt-natal !
for i in `seq 1 $COUNT`
do
  echo "==> ${RT[$i]}"
  echo -n "===> Configuracao do Script de rotas"
  echo -ne '   \t'
  (scp root@${ROTEADOR[$i]}:rotas/${VT[$i]}/script_rotas.conf confs/script_rotas.conf.${VT[$i]} >/dev/null 2>&1) && echo OK
  echo -n "===> Configuracoes de rede"
  echo -ne '   \t'
  for arq in /etc/sysconfig/network /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth1 /etc/sysconfig/network-scripts/ifcfg-eth2 /etc/sysconfig/network-scripts/route-eth0 /etc/sysconfig/network-scripts/route-eth1 /etc/sysconfig/network-scripts/route-eth2
  do
    mkdir -p sysconfs/network/${VT[$i]} > /dev/null 2>&1
    (scp root@${ROTEADOR[$i]}:$arq sysconfs/network/${VT[$i]}/ >/dev/null 2>&1) && echo -n "OK "
  done
  echo
  echo

done

# /etc/sysconfig/network
# /etc/sysconfig/network-scripts/ifcfg-eth0
# /etc/sysconfig/network-scripts/ifcfg-eth1
# /etc/sysconfig/network-scripts/route-eth1
